Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

34 arc f5 save slack channels #59

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from

Conversation

NikolayNN
Copy link

connect #34

"id",
"name"
})
@Getter
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe @DaTa instead of many Annotations?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@Service
public class SlackApiServiceImpl implements SlackApiService {

SlackApi slackApi;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

private?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@Setter
@NoArgsConstructor
@ToString
@EqualsAndHashCode

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need @entity annotation

@@ -1,4 +1,4 @@
package juja.microservices.slack.archive.model;
package juja.microservices.slack.archive.model.entity;

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

need @entity annotation

Copy link
Author

@NikolayNN NikolayNN Dec 27, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i read spring docs. MongoTemplate doesn't require @entity annotation

9.5. Saving, Updating, and Removing Documents
https://docs.spring.io/spring-data/mongodb/docs/current/reference/html/#mongo-template

and there are two ways with Id annotation.

  1. A property or field annotated with @id (org.springframework.data.annotation.Id) will be mapped to the _id field.
  2. A property or field without an annotation but named id will be mapped to the _id field.

I think it is a good case to use @id annotation explicitly

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Nikolay


public class Util {

public static String getFile(String fileName){

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe "readStringFromFile" ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok

hamster4n
hamster4n previously approved these changes Dec 26, 2017

@SpringBootApplication
@EnableScheduling
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, move @EnableScheduling to SchedulerConfig class
It will be better

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@@ -1,4 +1,4 @@
package juja.microservices.slack.archive.model;
package juja.microservices.slack.archive.model.entity;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with Nikolay

import juja.microservices.slack.archive.model.Channel;
import juja.microservices.slack.archive.model.Message;
import juja.microservices.slack.archive.model.entity.Channel;
import juja.microservices.slack.archive.model.entity.Message;

import java.util.List;

public interface ArchiveRepository {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe better extract logic for messages to another repository
and rename this repo to slackchannelrepository ?

what do you think?

Copy link
Author

@NikolayNN NikolayNN Jan 8, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh you suggest it too) ok I will do it

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!


@Repository
@Slf4j
public class SlackApiImpl implements SlackApi {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe is better naming for interface SlackApiClient?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


@Override
public List<ChannelDTO> receiveChannelsList() {
String urlTemplate = slackApiChannelsUrlTemplate + slackApiToken;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Old service use simpleslackapi,
Why do you use resttemplate instead?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will sort out with simpleSlackApi


import com.fasterxml.jackson.annotation.JsonCreator;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.*;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No * import

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

import juja.microservices.slack.archive.model.MessagesRequest;
import juja.microservices.slack.archive.model.dto.ChannelDTO;
import juja.microservices.slack.archive.model.dto.MessagesRequest;
import juja.microservices.slack.archive.model.entity.Message;

import java.util.List;

public interface ArchiveService {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe is better naming ChannelService and extract some messages logic to another service

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is a good idea and in this case I will do separate repositories for channel and messages

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!


String result = "";

Foo foo = new Foo();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the strange logic for reading the file
For example, you can use in test
IOUtils.toString(this.getClass().getClassLoader().getResourceAsStream(fileName));

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the method is static, I can't use non static method this.getClass() here

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I want to return this code into test or another case classz should be ones from parameters this method
After that this method becomes simple

@danilkuznetsov
Copy link
Member

danilkuznetsov commented Jan 3, 2018

@NikolayNN please update your branch from upstream and fix conflicts

…lack-channels

# Conflicts:
#	slack-archive/src/main/java/juja/microservices/slack/archive/SlackArchiveApplication.java
…o ChannelService, MessageService and ChannelRepository, MessageRepository
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants